#include<iostream>
using namespace std;
int main() {
	int n,temp=0,tem=0,x=1,j;
	cin >> n;
	for (j = 1; j < n; j++) {
		x *= 10;
	}
	for (int i = x; i <10*x;i++) {
		tem = 0;
		int sum = 0;
		for (int d,a=0,b=0,temp=i; tem<n; tem++) {
			d = 1;
			a = temp % 10; 
			temp /= 10;   
			for (int k = 1; k <= n; k++) {
				d *= a;
			}
			sum += d; 
		}
		if (sum == i) {
			cout << i << endl;
		}
	}
	return 0;
}
